#include <Lucnx/device.h>
#include <Lucnx/keyboard.h>

size_t tty_write(void *ptr, char *buf, int nr)
{
    dev_t dev = device_search("console");
    return device_write(dev, ptr, buf, nr);
}

size_t tty_read(void *ptr, char *buf, int nr)
{
    dev_t dev = device_search("keyboard");
    return device_read(dev, ptr, buf, nr);
}

void tty_init()
{
    device_install("tty", NULL, tty_read, tty_write, NULL, DEV_CHAR, DF_READ | DF_WRITE);
}